<?php
// 本类由系统自动生成，仅供测试用途
class TestAction extends Action {

    public function index(){
		Load('extend');
		$Product =   M('Product');
		//焦点图5条新闻
		$IndexArr = $Product->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb,v9_position_data.* FROM `v9_product` 
left join `v9_position_data` on  `v9_product`.id=`v9_position_data`.id  WHERE v9_product.title!='' AND v9_product.thumb!='' AND v9_position_data.posid =1 order by `v9_product`.id desc limit 0,5");

		//左边企业新闻12条
		$CompanyListArr = $Product->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=769 AND v9_news.title!=''  order by `v9_news`.id desc limit 0,12");

		//左边科技创新12条
		$KejiListArr = $Product->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=762 AND v9_news.title!=''  order by `v9_news`.id desc limit 0,12");

		//左边行业知识12条
		$KejiNewsListArr = $Product->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=764 AND v9_news.title!=''  order by `v9_news`.id desc limit 0,20");
		$HangyeLisArr = array_slice($KejiNewsListArr,0,12);
		

		//中间图片展示1条
		$HeadOneCenterArr = $Product->query("SELECT `v9_news`.url,`v9_news`.title,`v9_news`.inputtime,`v9_news`.description as adescription,v9_news.thumb as newsthumb FROM `v9_news` 
left join `v9_position_data` on  `v9_news`.id=`v9_position_data`.id  WHERE v9_news.title!='' AND v9_news.thumb!='' AND v9_position_data.posid =1 order by `v9_news`.id desc limit 0,1");

		//中间行业新闻8条
		$HangyeNewsLisArr = $Product->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=758 AND v9_news.title!=''  order by `v9_news`.id desc limit 0,20");
		$HangyeCenterArr = array_slice($HangyeNewsLisArr,0,8);

		
		
		//中间科技创新8条
		//$KejiCenterArr = $Product->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=762 AND v9_news.title!=''  order by `v9_news`.id desc limit 5,8");
		$KejiCenterArr = array_slice($KejiNewsListArr,12,8);

		//中间政策法规8条
		$ZhengcheCenterArr = $Product->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=770 AND v9_news.title!=''  order by `v9_news`.id desc limit 0,8");

		//中间分析预测8条
		$FenxiCenterArr = $Product->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=761 AND v9_news.title!=''  order by `v9_news`.id desc limit 0,8");

		//右边行业新闻12条
		$BaodaoRightArr = array_slice($HangyeNewsLisArr,8,12);
	
		//头部中间的8条新闻
		/*$HeadCenterArr = $Product->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb,v9_position_data.* FROM `v9_product` 
left join `v9_position_data` on  `v9_product`.id=`v9_position_data`.id  WHERE  v9_product.title!='' AND v9_position_data.posid =2 order by `v9_product`.id desc limit 0,5");*/
		
		//新闻快报
		$HeadImgListArr = $Product->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb FROM `v9_product`  WHERE v9_product.title!='' AND v9_product.thumb!='' order by `v9_product`.id desc limit 0,4");

		//$IndexKuaiArr = array_slice($HeadImgListArr,0,1);
		
		//热点图片
		//$NewTopArr = $Product->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb FROM `v9_product`  WHERE v9_product.title!='' AND v9_product.thumb!='' order by `v9_product`.id desc limit 4,6");

		$NewTopArr = array_slice($HeadImgListArr,0,4);


		//地板产品
		$DibanListArr = $Product->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb FROM `v9_product`  WHERE v9_product.catid IN (14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33) AND v9_product.title!=''  order by `v9_product`.id desc limit 0,10");
	
		
		//灯具产品
		$DengjuListArr = $Product->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb FROM `v9_product`  WHERE v9_product.catid IN (68,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216) AND v9_product.title!=''  order by `v9_product`.id desc limit 0,10");

		//家具产品
		$JiajuListArr = $Product->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb FROM `v9_product`  WHERE v9_product.catid IN (69,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231) AND v9_product.title!='' order by `v9_product`.id desc limit 0,10");
		

		//卫浴产品
		$WeiyuListArr = $Product->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb FROM `v9_product`  WHERE v9_product.catid IN (34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65) AND v9_product.title!=''  order by `v9_product`.id desc  limit 0,10");
		

		//门窗产品
		$MenchuangListArr = $Product->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb FROM `v9_product`  WHERE v9_product.catid IN (67,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175) AND v9_product.title!=''  order by `v9_product`.id desc  limit 0,15");

		//厨具产品
		$ChujuListArr = $Product->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb FROM `v9_product`  WHERE v9_product.catid IN (76,334,335,336,337,338,339,340,341,342,343,344,345,346) AND v9_product.title!=''  order by `v9_product`.id desc  limit 0,15");

		//$KejiListArr = array_slice($KejiNewsListArr,0,12);


		$this->assign('IndexArr',$IndexArr);
		$this->assign('IndexKuaiArr',$IndexKuaiArr);
		$this->assign('HeadArr',$HeadArr);
		$this->assign('HeadCenterArr',$HeadCenterArr);
		$this->assign('HeadArr',$HeadArr);
		$this->assign('NewTopArr',$NewTopArr);


		$this->assign('CompanyListArr',$CompanyListArr);
		$this->assign('KejiListArr',$KejiListArr);
		$this->assign('HangyeLisArr',$HangyeLisArr);

		$this->assign('HeadOneCenterArr',$HeadOneCenterArr);
		$this->assign('HangyeCenterArr',$HangyeCenterArr);
		$this->assign('KejiCenterArr',$KejiCenterArr);
		$this->assign('ZhengcheCenterArr',$ZhengcheCenterArr);
		$this->assign('FenxiCenterArr',$FenxiCenterArr);
		$this->assign('BaodaoRightArr',$BaodaoRightArr);


		$this->assign('DibanListArr',$DibanListArr);
		$this->assign('DengjuListArr',$DengjuListArr);
		$this->assign('JiajuListArr',$JiajuListArr);
		$this->assign('WeiyuListArr',$WeiyuListArr);
		$this->assign('MenchuangListArr',$MenchuangListArr);
		$this->assign('ChujuListArr',$ChujuListArr);



		//取到网站友情链接
		$LinkArr = $Product->query("SELECT name,url FROM `v9_link` WHERE passed=1 ORDER BY linkid DESC");
		$this->assign('LinkArr',$LinkArr);

		$keys = explode(',',$seo_Arr);
		$SEO['title'] = '都市家建材网-中国最全的建材种类行业门户网站';
		$SEO['keywords'] = '都市家建材网,建材网,建材网站,建材产品,建材新闻';
		$SEO['description'] = '都市家建材网提供专业且全面的建材产品供求信息,主要信息包含:建材产品的报价,建材产品的品牌,建材产品的招商，加盟以及建材代理信息,为广大建材行业的个人与企业同行们，提供海量的建材信息与商机，努力打造成中国最全的建材种类行业门户网站.';
		$this->assign('SEO',$SEO);// SEO相关
		//生成静态页
		$htmlpath = '/home/www/dushijia_com/';
		$htmlfile = 'index';
		$this->buildHtml($htmlfile,$htmlpath,'index','utf8');

		$this->display(); // 输出模板

    }

	 public function show(){
		echo '@@@@';exit;
	 }



}